//---------------------------------------------------------------------------------------------------------------------------------------------------------//
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
#include "PatternMatches.h"
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
#define LENGTHTEXT 1000
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
PatternMatches::PatternMatches ():paramCode(0) {
  
  this->code     = new String ();
  this->matches  = new String ();
  this->toString = new String ();
    
}
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
PatternMatches::PatternMatches (int paramCode, String* code, String* matches) {
  
  this->paramCode = paramCode;
  this->code      = new String (code);
  this->matches   = new String (matches);
  this->toString  = new String ();
    
}
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
PatternMatches::PatternMatches (int paramCode, char* code, char* matches) {
  
  this->paramCode = paramCode;
  this->code      = new String (code);
  this->matches   = new String (matches);
  this->toString  = new String ();
    
}
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
PatternMatches::PatternMatches (const PatternMatches& patternMatches) {
  
  this->paramCode = patternMatches.paramCode;
  this->code      = new String (patternMatches.code);
  this->matches   = new String (patternMatches.matches);
  this->toString  = new String ();
    
}
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
PatternMatches::PatternMatches (const PatternMatches* patternMatches) {
  
  this->paramCode = patternMatches->paramCode;
  this->code      = new String (patternMatches->code);
  this->matches   = new String (patternMatches->matches);
  this->toString  = new String ();
    
}
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
PatternMatches::~PatternMatches () {
  
  if (this->code)     delete this->code;
  if (this->matches)  delete this->matches;
  if (this->toString) delete this->toString;
  
}
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
void PatternMatches::ParamCode (int paramCode) {
  
  this->paramCode = paramCode;
  
}
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
void PatternMatches::Code (String* code) {
  
  if (code) this->code->In(code);
  
}
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
void PatternMatches::Matches (String* matches) {
  
  if (matches) this->matches->In(matches);
  
}
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
int PatternMatches::ParamCode (void) {
  
  return this->paramCode;
  
}
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
String* PatternMatches::Code (void) {
  
  return this->code;
  
}
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
String* PatternMatches::Matches (void) {
  
  return this->matches;
  
}
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
String* PatternMatches::ToString (void) {
  
  char    buffer [LENGTHTEXT + 1];
  
  sprintf(buffer, "%d %s %s\0", this->paramCode,
                                this->code->Out(),
                                this->matches->Out());
  
  this->toString->In(buffer);
  
  return this->toString;
  
}
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
PatternMatches PatternMatches::operator= (const PatternMatches& patternMatches) {
  
  this->paramCode = patternMatches.paramCode;
  
  this->code->In(patternMatches.code);
  this->matches->In(patternMatches.matches);
    
  return *this;
  
}
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
